function Grid=PlotSetup_YTickValue(YLim,YMid,SymFlag)

%% Preliminaries
GridNum = 6; GridScaleList = [0.1;0.2;0.5;1;2];
if nargin<=1
    YMid = [];
    SymFlag = 0;
elseif nargin<=2
    SymFlag = 0;
end


%% Scales
YMax = max([YLim(:);YMid]); YMin = min([YLim(:);YMid]);
if SymFlag
    YMaxGap = max([abs((YMax-YMid));abs((YMin-YMid))]);
    YMax = YMid+YMaxGap; YMin = YMid-YMaxGap;
end

Scale = max(abs([YMax;YMin])); 

%% Increment Unit
Scale_ExpNum = floor(log(Scale)/log(10));
YMaxRound = YMax/(10^Scale_ExpNum); YMinRound = YMin/(10^Scale_ExpNum);
for ii=1:length(GridScaleList)
    if (YMaxRound-YMinRound)/GridNum/GridScaleList(ii)<=2; break; end
end
    
GridUnit = GridScaleList(ii)*(10^Scale_ExpNum);

Grid = (floor(YMin/GridUnit):1:ceil(YMax/GridUnit))'*GridUnit;

